using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace Koda.UI
{
    public partial class CodeTreeView : TreeView
    {
        private const int c1 = 0x0014;
        private const int c2 = 0x0000;

        public CodeTreeView()
        {
            this.InitializeComponent();
        }

        protected override void WndProc(ref Message messg)
        {
            // if message is erase background
            if (messg.Msg == c1)
            {
                messg.Msg = c2; // reset message to null
            }

            base.WndProc(ref messg);
        }

        private void CodeTreeView_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right && e.Clicks == 1)
            {
                TreeNode node = this.GetNodeAt(e.X, e.Y);
                if (node != null)
                {
                    this.SelectedNode = node;
                }
            }
        }
    }
}